home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Original Shareware 1.1
/
The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso
/
18
/
fpc103.zip
/
SEDCODE.SEQ
< prev
next >
Wrap
Text File
|
1988-06-30
|
4KB
|
112 lines
\ SEDCODE.SEQ The Assembly code needed for SED by Tom Zimmer
only forth also hidden definitions also
code tb: ( a1 -- tsegb a1 ) \ add text segment base to stack
pop ax \ under a1 in prep for long operation
mov dx, tsegb
2push
end-code
code tl: ( a1 -- lseg a1 ) \ add list segment base to stack
pop ax \ under a1 in prep for long operation
mov dx, lseg
2push
end-code
code tl+ ( a1 --- a2 ) \ a2 = a1 + 2, the list entry size in bytes
pop ax add ax, # 2
1push end-code
code tl- ( a1 --- a2 ) \ a2 = a1 - 2, the list entry size in bytes
pop ax sub ax, # 2
1push end-code
code tl* ( n1 -- n2 ) \ n2 = n1 * 2, the list entry size in bytes
pop ax shl ax, # 1
1push end-code
code ?exit ( f1 -- ) \ exit from definition on boolean f1.
pop ax
or ax, ax
0<> if
jmp ' exit
then
next
end-code
code getdiskfree \ return free space from disk
( dv --- avail.clusters bytes/sec secs/cluster )
mov ah, # 54
pop dx
int 33
push bx
push cx
1push
end-code
code >lineptr ( n1 --- a1 )
pop ax
shl ax, # 1
1push
end-code
code lineptr ( --- a1 )
mov ax, ' curline >body
shl ax, # 1 \ shift left by 2, for word size
1push \ of list pointer table.
end-code
code tl:@ ( a1 -- n1 )
pop bx mov ds, lseg
mov ax, 0 [bx]
mov bx, cs mov ds, bx
1push end-code
code tl:! ( n adr -- )
pop bx mov ds, lseg
pop ax mov 0 [bx], ax
mov bx, cs mov ds, bx
NEXT END-CODE
code #linedata ( n1 --- a1 n2 ) \ n1 = line, a1,n2 = addr & len
pop bx \ get line number
shl bx, # 1 \ convert to word offset
mov ds, lseg \ set DS to Linelist segment
mov ax, 0 [bx] \ get line address
push ax \ push it
mov dx, ax \ save to subtract later
mov ax, 2 [bx] \ get next list address
sub ax, dx \ subtract to get line length
mov bx, cs
mov ds, bx \ restore DS
1push end-code
code clipline ( a1 n1 --- a2 n3 )
mov bx, ' screenchar >body \ get the value of screenchar
pop cx
pop dx
mov ax, # 40
begin
cmp bx, # 79
> while
sub bx, ax
sub cx, ax
add dx, ax
repeat
push dx
push cx
next
end-code
code qmod ( n1 n1 -- Remainder ) \ a quick modulus operator
pop bx mov dx, # 0
pop ax
div bx push dx
next
end-code
only forth also definitions